import  { IRequestConfig, IProvider  } from '../types/data.interface'
export class  Snail {
    private configMap: Map<string, Map<string, IRequestConfig>> = new Map()
    private providerMap: Map<string, IProvider> = new Map()
    private globalBaseUrl: Map<string, string> =  new Map()

    setConfig(key:string, config: Map<string, IRequestConfig>) {
        this.configMap.set(key, config)
    }
    getConfig(key: string): Map<string, IRequestConfig> | null {
        return this.configMap.get(key) || null
    }
    setProvider(key: string, provider: IProvider) {
        this.providerMap.set(key, provider)
    }
    getProvider(key: string):  IProvider | null  {
        return this.providerMap.get(key) || null
    }
    setBaseUrl(key:string, url: string) {
        this.globalBaseUrl.set(key, url)
    }
    getBaseUrl(key: string): string {
        return  this.globalBaseUrl.get(key) || ''
    }
}

export default new Snail()